﻿<!DOCTYPE html>
<html lang="zh-CN" class="">
  <head>
    <meta charset="utf-8">
    <meta name="apple-itunes-app" content="app-id=432274380">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="description" content="一个真实的网络问答社区，帮助你寻找答案，分享知识。" />
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    <title>知乎 - 与世界分享你的知识、经验和见解</title>
    <link rel="apple-touch-icon" href="https://static.zhihu.com/static/revved/img/ios/touch-icon-152.87c020b9.png" sizes="152x152">
    <link rel="apple-touch-icon" href="https://static.zhihu.com/static/revved/img/ios/touch-icon-120.496c913b.png" sizes="120x120">
    <link rel="apple-touch-icon" href="https://static.zhihu.com/static/revved/img/ios/touch-icon-76.dcf79352.png" sizes="76x76">
    <link rel="apple-touch-icon" href="https://static.zhihu.com/static/revved/img/ios/touch-icon-60.9911cffb.png" sizes="60x60">
    <link rel="shortcut icon" href="https://static.zhihu.com/static/favicon.ico" type="image/x-icon" />
    <link rel="dns-prefetch" href="p1.zhimg.com" />
    <link rel="dns-prefetch" href="p2.zhimg.com" />
    <link rel="dns-prefetch" href="p3.zhimg.com" />
    <link rel="dns-prefetch" href="p4.zhimg.com" />
    <link rel="dns-prefetch" href="comet.zhihu.com" />
    <link rel="dns-prefetch" href="static.zhihu.com" />
    <link rel="dns-prefetch" href="upload.zhihu.com" />
    <link rel="stylesheet" href="/homeCSS/css/main.92bd852f.css">
    <meta name="google-site-verification" content="FTeR0c8arOPKh8c5DYh_9uu98_zJbaWw53J-Sch9MTg" />
    <meta name="baidu-site-verification" content="KPFppAFoYF4Kkdv9" />
    <meta property="qc:admins" content="00544670776201056375" />
    <link rel="canonical" href="http://www.zhihu.com" />
    
    <meta id="znonce" name="znonce" content="ca6e5a06c3a74cfa88c7b97cf26aa3dd">
     <script type="text/javascript" src="/homeCSS/js/jquery-1.8.3.min.js"></script>
                    </script>
    <script type="text/javascript" src="/homeCSS/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/homeCSS/js/vendor.js"></script>
    
    <style>
      a{text-decoration: none};
    </style>
    <!--[if lt IE 9]>
      <script src="js/respond.min.js"></script>
      <link href="https://static.zhihu.com/static/components/respond/cross-domain/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
      <link href="/static/components/respond/cross-domain/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
      <script src="js/respond.proxy.js"></script>
    <![endif]-->
  </head>
  


  <body class="zhi ">
  <div class="container-fluid">
    <div class="index-main">
      <div class="index-main-body">
        <div class="index-header">
          <h1 class="logo hide-text">知乎</h1>
          <h2 class="subtitle">与世界分享你的知识、经验和见解</h2></div>
        <div class="desk-front sign-flow clearfix sign-flow-simple">
          <div class="index-tab-navs">
            <div class="navs-slider">
              <a href="#signup" id="zc1" class="active" >注册</a>
              <a href="#signin" id='dl1' class="active">登录</a>
            </div>
          </div>
          <div  id="dl" style="dispaly:none" class="view view-signin" data-za-module="SignInForm">
            <form id="tj" method="post" onclick="return false" action="/home/user/login">
              <input type="hidden" name="_xsrf" value="e11206c20991c4413fe8b756de71b085" />
              <div class="group-inputs">

                <div class="account input-wrapper">
                  {{ csrf_field() }}
                <input type="text" name="name" aria-label="手机号或邮箱" placeholder="请输入用户名" required="">
                <label style="display:none" class="error is-visible">请填写用户名</label>
                <label id='n' style="display:none" class="error is-visible">用户名不正确</label>
                </div>
                <div class="verification input-wrapper">
                <input type="password" name="password" aria-label="密码" placeholder="请输入密码" required="">
                <label style="display:none" class="error is-visible">请填写密码</label>
                <label id="p" style="display:none" class="error is-visible">密码不正确</label>
                <button  type="button" class="send-code-button">获取验证码</button>
                </div>
              </div>
              <div class="button-wrapper command">
                <button id="btn" class="sign-button submit" type="submit">登录</button></div>
              <div class="signin-misc-wrapper clearfix">
                <button type="button" class="signin-switch-button">手机验证码登录</button>
                <a class="unable-login" href="#">无法登录？</a></div>
              <div class="social-signup-wrapper" data-za-module="SNSSignIn">
                <span class="name js-toggle-sns-buttons">社交帐号登录</span>
                <div class="sns-buttons">
                  <a title="微信登录" class="js-bindwechat" href="#">
                    <i class="sprite-index-icon-wechat"></i>
                  </a>
                  <a title="微博登录" class="js-bindweibo" href="#">
                    <i class="sprite-index-icon-weibo"></i>
                  </a>
                  <a title="QQ 登录" class="js-bindqq" href="#">
                    <i class="sprite-index-icon-qq"></i>
                  </a>
                </div>
              </div>
            </form>
              
           
            <div class="QRCode">
              <button class="QRCode-toggleButton">
                <span class="sprite-global-icon-qrcode"></span>
                <span class="QRCode-toggleButtonText ">下载知乎 App</span></button>
              <div class="QRCode-card">
                <div class="QRCode-image"></div>
                <div class="sprite-index-icon-arrow"></div>
              </div>
            </div>
          </div>
          <div class="view view-signup selected" data-za-module="SignUpForm">
            <form id="zc" class="zu-side-login-box" action="/home/user/insert" id="sign-form-1" autocomplete="off" method="POST">
              <input type="password" hidden>
              <input type="hidden" name="_xsrf" value="e11206c20991c4413fe8b756de71b085" />
              <div class="group-inputs">
              {{ csrf_field() }} 
                <div class="name input-wrapper">
                  <input required="" type="text" name="fullname" aria-label="用户名" placeholder="用户名">
                  <label style="display:none" class="error is-visible">请填写用户名</label>
                  <label id='n1' style="display:none" class="error is-visible">用户名已被注册</label>
                  <label style="display:none" class="error is-visible">用户名须为6-16位的字母或数字</label>
                  <span style="display:none"><label class="error is-visible" style="color:green">用户名正确</label></span>
                  </div>
                  <div class="input-wrapper">
                  <input required type="password" name="password1" aria-label="密码" placeholder="密码（不少于 6 位）" autocomplete="off">
                   <label style="display:none" class="error is-visible">6-16位的字母、数字组合</label>
                    <span style="display:none"><label class="error is-visible" style="color:green">密码正确</label></span>
                  </div>
                  <div class="email input-wrapper">
                  <input required type="text" class="account" name="phone" aria-label="手机号（仅支持中国大陆）" placeholder="手机号（仅支持中国大陆）">
                  <label style="display:none" class="error is-visible">请输入正确的手机号</label>
                  <span style="display:none"><label class="error is-visible" style="color:green">手机号正确</label></span>
                   <label style="display:none" class="error is-visible">手机号已被注册</label>
                   <label style="display:none" id="sb" class="error is-visible">验证码发送失败</label>
                  </div>
                  <!-- 记号 -->
                  <div style="display:none"  class="email input-wrapper"><button id="yzm" class="sign-button submit" style="width:100px;height:40px;">发送验证码</button></div>
                  <div class="name input-wrapper">
                  <input required type="text" name="yzmname" aria-label="姓名" placeholder="输入手机验证码">
                  <label id="yzsb" style="display:none" class="error is-visible">验证码验证失败</label>
                  </div>
                <div class="Captcha input-wrapper" data-type="cn" data-za-module="Captcha">
                  <div class="Captcha-operate">
                    <input type="hidden" name="captcha" required data-rule-required="true" data-msg-required="请点击图中所有倒立的文字">
                    <input type="hidden" name="captcha_type" value="cn" required>
                    <label class="Captcha-prompt">请点击图中所有倒立的文字</label>
                    <span class="Captcha-refresh js-refreshCaptcha sprite-index-icon-refresh"></span>
                  </div>
                  <div class="Captcha-imageConatiner">
                    <img class="Captcha-image" alt="验证码"></div>
                </div>
              </div>
              <div class="button-wrapper command">
                <button id="zczh" class="sign-button submit" type="submit">注册知乎</button></div>
            </form>
            <script>
            
              //鼠标丧失焦点事件  第一个名字ajax
                  $('input[name=fullname]').blur(function(){
                    var inp1=$(this);
                    var val = $(this).val();
                   
                     //发送ajax验证用户名
                      $.ajax({
                      url:'/home/user/zc',
                      data:{name:val},
                      type:'get',
                      success:function(data){
                         // alert(data);
                         if (data==1) {
                          $('#n1').removeAttr('style');

                          inp1.next().next().next().hide();//隐藏起来
                          inp1.next().next().next().next().hide();
                        }
                       }
                     
                      })
                    var ret = /^[a-zA-Z][a-zA-Z0-9_]{5,20}$/;
                    if(!ret.test(val)){
                      $(this).next().next().next().removeAttr('style');//用户名格式不正确
                       $(this).next().next().next().next().hide();
                    }else{
                      $(this).next().next().next().hide();//隐藏起来
                      $('#n1').hide()//用户名被注册隐藏起来
                      $(this).next().next().next().next().removeAttr('style');//用户名正确
                     
                    }
                     
                })

                  //第二个验证密码规则
                  $('input[name=password1]').blur(function(){
                    var inp2=$(this).val();
                     var ret = /^[a-zA-Z][a-zA-Z0-9_]{5,20}$/;
                     var res=ret.test(inp2);
                    if(!res){
                      $(this).next().removeAttr('style');
                      $(this).next().next().hide();
                    }else{
                       $(this).next().next().removeAttr('style');
                       $(this).next().hide();
                    }
                  })
                  //验证手机号规则
                  $('input[name=phone]').blur(function(){
                    var inp2=$(this).val();
                     var ret = /^1(3|4|5|7|8)\d{9}$/;
                     var res=ret.test(inp2);
                     var dd=$(this);
                    if(!res){
                      $(this).next().removeAttr('style');
                       $(this).next().next().hide();
                    }else{
                       $(this).next().next().removeAttr('style');
                       $(this).next().hide();
                        //发送ajax验证手机号是否注册过
                        $.ajax({
                      url:'/home/user/yzphone',
                      data:{phone:inp2},
                      type:'get',
                      success:function(data){
                       if (data==1) {
                          dd.next().next().next().removeAttr('style');//手机号不正确
                       };
                       if (data==2) {
                          dd.parent().next().show();//显示出验证码
                          dd.next().next().next().hide();
                       };
                       }
                      })
                    }
                  })
                  //发送验证码// 记号
                  $('#yzm').click(function(){
                    // alert(1);
                    //获取手机号
                   var phone=$('input[name=phone]').val();
                   //发送ajax
                      $.ajax({
                      url:'/home/user/yzm',
                      data:{phone:phone},
                      type:'get',
                      success:function(data){
                        alert(data);
                        if (!data) {
                          $('#sb').show();
                          $('#sb').prev().prev().hide();//隐藏掉手机号正确
                        };
                       }
                      })
                  })
                  //开始验证提交
                  $('#zczh').click(function(){
                    var code=$('input[name=yzmname]').val();
                    //发送ajax
                     $.ajax({
                      url:'/home/user/register',
                      data:{code:code},
                      type:'get',
                      success:function(data){
                        if (data==2) {
                          $('#yzsb').show();
                        };
                       }
                      })

                  })
                  $('#btn').click(function(){
                      var name=$('input[name=name]').val();
                      var password= $('input[name=password]').val();
                      
                      // console.log(btn);
                      $.ajax({
                      url:'/home/user/login',
                      data:{name:name,password:password},
                      type:'get',
                      success:function(data){
                         if (data==1) {
                          $('#n').removeAttr('style');
                        }else if(data==2){
                          //alert(2);
                          $('#p').removeAttr('style');
                        }else if(data==3){
                            var btn=$('#tj').removeAttr('onclick');
                        }
                       async:false
                       }
                     
                      })
                  })
            </script>
          <script>
          //登录注册切换
              $('#dl1').click(function(){
                  $('#dl').show();
                  $('#zc').hide();
                  $('#zc1').removeAttr('class');
                  $('#dl1').attr('class','active');
              })
              $('#zc1').click(function(){
                  $('#dl').hide();
                  $('#zc').show();
                  $('#dl1').removeAttr('class');
                  $('#zc1').attr('class','active');
              })
          </script>
            <p class="agreement-tip">点击「注册」按钮，即代表你同意
              <a href="/terms" target="_blank">《知乎协议》</a></p>
          </div>
        </div>
      </div>
    </div>

    <div class="footer">
      <span>&copy; 2017 知乎</span>
      <span class="dot">·</span>
      <a target="_blank" href="/roundtable">知乎圆桌</a>
      <span class="dot">·</span>
      <a target="_blank" href="/explore" data-za-c="explore" data-za-a="visit_explore" data-za-l="home_bottom_explore">发现</a>
      <span class="dot">·</span>
      <a target="_blank" href="/app">移动应用</a>
      <span class="dot">·</span>
      <a href="/org/signin" class="footer-mobile-show">使用机构帐号登录</a>
      <span class="dot footer-mobile-show">·</span>
      <a href="/contact" class="footer-mobile-show">联系我们</a>
      <span class="dot">·</span>
      <a target="_blank" href="/careers">来知乎工作</a>
      <br />
      <a href="http://www.miibeian.gov.cn/" target="_blank">京 ICP 证 110745 号</a>
      <span class="dot">·</span>
      <span>京公网安备 11010802010035 号</span>
      <span class="dot">·</span>
      <a href="http://zhstatic.zhihu.com/assets/zhihu/publish-license.jpg" target="_blank">出版物经营许可证</a></div>
    <script type="text/json" class="json-inline" data-name="disabled_components">["back_to_top"]</script>
    <script type="text/json" class="json-inline" data-name="current_user">["", "", "", "-1", "", 0, 0]</script>
    <script type="text/json" class="json-inline" data-name="env">["zhihu.com", "comet.zhihu.com", false, null, false, false]</script>
    <script type="text/json" class="json-inline" data-name="ga_vars">{
        "user_created": 0,
        "now": 1490853201000,
        "abtest_mask": "------------------------------",
        "user_attr": [0, 0, 0, "-", "-"],
        "user_hash": 0
      }</script>
    <meta name="entry" content="ZH.entrySignPage" data-module-id="page-index">
    <input type="hidden" name="_xsrf" value="e11206c20991c4413fe8b756de71b085" /><div></body>
    <!--<script src="/homeCSS/js/instant.14757a4a.js"></script>
    <script src="/homeCSS/js/vendor.cb14a042.js"></script>
    <script src="/homeCSS/js/base.3b6b275f.js"></script>
  
    <script src="/homeCSS/js/page-index.ecef04da.js"></script>-->

</html>
 <script>

                  //鼠标丧失焦点事件  第一个名字ajax
                  $('input[name=name]').blur(function(){
                    //发送ajax去验证用户名是否存在
                    var inp1=$(this);
                    var inp = $(this).val();
                    if (!inp) {
                      $(this).next().removeAttr('style');
                    };
                   
                })

                  //第二个密码
                  $('input[name=password]').blur(function(){
                    var inp2=$(this).val();
                    if (!inp2) {
                      $(this).next().removeAttr('style');
                    };
                  })
                  $('#btn').click(function(){
                      var name=$('input[name=name]').val();
                      var password= $('input[name=password]').val();
                      
                      console.log(btn);
                      $.ajax({
                      url:'/home/user/login',
                      data:{name:name,password:password},
                      type:'get',
                      success:function(data){
                         if (data==1) {
                          $('#n').removeAttr('style');
                        }else if(data==2){
                          //alert(2);
                          $('#p').removeAttr('style');
                        }else if(data==3){
                            var btn=$('#tj').removeAttr('onclick');
                        }
                       async:false
                       }
                     
                      })
                  })
                  //提交
 </script>